package com.ojoin.trade.common.web.dao.impl;

import com.ojoin.trade.common.exception.DaoException;
import com.ojoin.trade.common.web.dao.NotificationDao;
import com.ojoin.trade.common.web.domain.Notification;
import org.springframework.stereotype.Repository;


@Repository
public class  NotificationDaoImpl extends BaseDaoImpl<Notification> implements NotificationDao {

    public void markReadAll(Integer userId) {
    	String mapMethodName = new Exception().getStackTrace()[0].getMethodName(); 
		try {
			 this.sqlSessionTemplate.update(getSqlName(mapMethodName),userId);
		} catch (Exception e) {
			throw new DaoException(String.format("语句：%s",getSqlName(mapMethodName)), e);
		}
	}

    public int fixedAll(String type) {
    	String mapMethodName = new Exception().getStackTrace()[0].getMethodName(); 
		int effectRow=-1;
    	try {
    		effectRow= this.sqlSessionTemplate.update(getSqlName(mapMethodName),type);
		} catch (Exception e) {
			throw new DaoException(String.format("语句：%s",getSqlName(mapMethodName)), e);
		}
    	return effectRow;
	}
    
}
